
<%@ page import="zara.Task" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'task.label', default: 'Task')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.list.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="list">
                <table>
                    <thead>
                        <tr>  <th></th>
                            <g:sortableColumn property="name" title="任务名" />
                            <g:sortableColumn property="available" title="状态" />
                            <g:sortableColumn property="seek" title="权重" />
                        
                            <th><g:message code="task.website.label" default="站点名称" /></th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${taskInstanceList}" status="i" var="taskInstance">
                        <tr style="background:none repeat scroll 0 0 ${taskInstance.available?'#FFF':'#FBB'};">
                          <td style="background:none repeat scroll 0 0 #${taskInstance.website.toColor()};" width="2"></td>
                            <td>${fieldValue(bean: taskInstance, field: "name")}</td>
                            <td>
                            <g:if test="${taskInstance.available}">
                                <font size="" color="green">开启状态</font><g:link action="close" id="${taskInstance.id}">（关闭）</g:link>
                            </g:if>
                            <g:else>
                               <font size="" color="red">关闭状态</font><g:link  action="open" id="${taskInstance.id}">（开启）</g:link>
                            </g:else>
                            
                            </td>
                        
                            <td>${ taskInstance.seek} </td>
                            <td>${fieldValue(bean: taskInstance, field: "website")}</td>
                            <td>
                            <ul>
<g:each in="${taskInstance?.actions?}" var="a">
    <li>${a?.encodeAsHTML()}</li>
</g:each>
</ul>
<g:link controller="webAction" action="createAll" params="['taskid': taskInstance?.id]">编辑动作</g:link>
|||
<g:link controller="task" action="delete" id="${taskInstance?.id}" onclick="return confirm('确定删除此任务吗?');">删除任务</g:link>

                            </td>
                        
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${taskInstanceTotal}" />
            </div>
        </div>
    </body>
</html>
